package io.renren.modules.app.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.UpdateGroup;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * 收货地址实体
 * @author zzh
 * @email 862583291@qq.com
 * @date 2019-7-3 12:27
 */
@TableName("nideshop_address")
@Data
public class AddressVo implements Serializable {
    private static final long serialVersionUID = 1L;
    //主键
    @TableId(type = IdType.AUTO)
    @NotNull(message = "id不能为空", groups = {UpdateGroup.class})
    private Long id;
    //会员ID
    @NotNull(message = "会员不能为空", groups = {AddGroup.class})
    private Long userId;
    //收货人姓名
    @NotBlank(message = "用户名不能为空", groups = {AddGroup.class})
    private String userName;
    //手机
    @NotBlank(message = "手机号码不能为空", groups = {AddGroup.class})
    @Pattern(regexp = "^1[0-9]{10}$", message = "手机格式错误", groups = {AddGroup.class, UpdateGroup.class})
    private String telNumber;
    //邮编
    private String postalCode;
    //收货地址国家码
    private String nationalCode;
    //省
    private String provinceName;
    //市
    private String cityName;
    //区
    private String countyName;
    //详细收货地址信息
    @NotBlank(message = "详细地址不能为空", groups = {AddGroup.class})
    private String detailInfo;
    //地址信息
    @NotBlank(message = "地址不能为空", groups = {AddGroup.class})
    private String name;
    //门牌号
    @NotBlank(message = "门牌号不能为空", groups = {AddGroup.class})
    private String area;
    //默认
    private Integer isDefault = 0;
    @TableField(exist = false)
    private String fullRegion;
}
